<!--
 * @Author       : gy
 * @Date         : 2020-07-01 23:54:51
 * @LastEditors  : gy
 * @LastEditTime : 2020-07-09 23:26:25
 * @FilePath     : /code/src/views/material-management/pages/station-management.vue
 * @Description  : 页面描述
-->
<template>
    <div class="app-container">
        <div class="search-wrapper">
            <el-form :inline="true" class="demo-form-inline">
                <el-form-item label="工位编号">
                    <el-input
                        v-model="form.station_code"
                        placeholder="请输入工位编号"
                    ></el-input>
                </el-form-item>
                <el-form-item label="创建时间">
                    <el-date-picker
                        v-model="form.timeRange"
                        type="daterange"
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                    >
                    </el-date-picker>
                </el-form-item>
            </el-form>
            <el-form :inline="true" class="demo-form-inline">
                <el-form-item label="工位名称">
                    <el-input
                        v-model="form.station_name"
                        placeholder="请输入工位名称"
                    ></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="handleSearch">搜索</el-button>
                    <el-button @click="handleReset">重置</el-button>
                </el-form-item>
            </el-form>
        </div>
        <div class="list-wrapper">
            <div class="content">
                <div class="title">
                    <span>工位管理</span>
                </div>
                <div class="operation">
                    <el-button type="primary" @click="handleAdd">新增</el-button>
                    <el-popconfirm
                        title="确定删除吗？"
                        @onConfirm="handleDelete('pk_id')"
                    >
                        <el-button slot="reference">删除</el-button>
                    </el-popconfirm>
                    <el-button @click="handleExport">导出</el-button>
                </div>
                <comm-table
                    ref="comm-table"
                    :loading="loading"
                    :data="tableData"
                    style="width: 100%"
                >
                    <el-table-column width="80" type="selection" />
                    <el-table-column
                        prop="station_code"
                        label="工位编号"
                        width="180"
                    />
                    <el-table-column
                        prop="station_name"
                        label="工位名称
"
                        width="180"
                    />
                    <el-table-column prop="station_desc" label="工位描述" />
                    <el-table-column prop="status" label="状态" />
                    <el-table-column prop="create_time" label="创建时间" />
                                        <el-table-column
                        header-align="center"
                        align="center"
                        prop="prop"
                        label="操作"
                    >
                        <template slot-scope="scope">
                            <span
                                class="operation-btn"
                                @click="handleEdit(scope)"
                                >编辑</span
                            >
                            <el-popconfirm
                                title="确定删除吗？"
                                @onConfirm="
                                    handleDeleteOne({ ids: scope.row.pk_id })
                                "
                            >
                                <span class="operation-btn" slot="reference"
                                    >删除</span
                                >
                            </el-popconfirm>
                        </template>
                    </el-table-column>
                </comm-table>
            </div>
        </div>
        <el-dialog
            :visible="dialogVisible"
            :title="title"
            @close="dialogVisible = false"
        >
            <AddStation ref="addDialog" />
            <div class="dialog-footer">
                <el-button @click="handleConfirm" type="primary"
                    >确认</el-button
                >
                <el-button>取消</el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script>
import TableCommMixin from "@/mixins/TableCommMixin";
import { postAction, getAction } from "@/api/manage";
import AddStation from "../modules/add-station";

export default {
    name: "StationManagement",
    mixins: [TableCommMixin],
    components:{AddStation},
    data() {
        return {
            form: {
                timeRange: "",
                station_name: "",
                station_code:""
            },
            url: {
                list: "/material/api/MesStation",
                add: "/material/api/MesStation",
                addMethod: "post",
                edit: "/material/api/MesStation",
                editMethod: "put",
                delete: "/material/api/MesStation",
                deleteMethod:'delete',
                export: "/material/api/MesStation/Export"
            }
        };
    },
    created() {},
    methods: {},
    mounted() {}
};
</script>
